<%--                                                                       --%>
<%-- Copyright (c) 2005 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>


<%@ page import =  "java.util.HashMap,
                    org.apache.commons.beanutils.PropertyUtils,
                    org.apache.struts.validator.DynaValidatorForm"
%>

<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<%
  java.util.HashMap map = new java.util.HashMap();
  DynaValidatorForm mtUserEditForm = (DynaValidatorForm) request.getAttribute("mtUserEditForm");
  map.put("userId", (Long) PropertyUtils.getSimpleProperty(mtUserEditForm, "userId"));
  pageContext.setAttribute("pagetabParam", map, PageContext.PAGE_SCOPE);
%>

<%
  String ctxPath = request.getContextPath();
%>
<html-el:javascript formName="mtUserEditForm"/>

<script language="javascript"
	src="<%=request.getContextPath()%>/mc/js/date.js"
	type="text/javascript"></script>

<script type="text/javascript">
<%@ include file="/mc/common/jsutils.jsp" %>
</script>

<script language="JavaScript">
  function checkForm(){
  	checkSecurityQuestion();
  	updateLDAPData();
  }
  /* *****************************  */
    function checkSecurityQuestion() {
	  	qList=document.getElementById("SECRET_QUESTION_1");
	  	qBox=document.getElementById("SECRET_QUESTION_2");
	  	if(qList.value==-1){
	  		//alert("Please select security Question");
	  		//return;
	  	}
	  	else if(qList.value==-2){
	  		if(qBox.value==''||qBox.value=='Type custom Question..'){
	  			//alert("Please enter security Question");
	  			//return;
	  		}
	  		else {
	  			setQuestionValue(qBox.value,qList.value);
	  		}
	  	}
	  	else {
	  		var w = qList.selectedIndex;
			var selected_text = qList.options[w].text;
	  		setQuestionValue(selected_text,qList.value);
	  	}
   }
   function updateLDAPData(){
	   //document.getElementById("SECRET_QUESTION_LDAP").value=
	   document.getElementById("ANSWER_LDAP").value=getElementValue(document.mtUserEditForm,"ANSWER");
	   document.getElementById("MOBILE_NO_LDAP").value=getElementValue(document.mtUserEditForm,"MOBILE_NO");
	   document.getElementById("CONTRACT_NUMBER_LDAP").value=getElementValue(document.mtUserEditForm,"CONTRACT_NUMBER");
	   document.getElementById("USER_DETAILS_LDAP").value=getElementValue(document.mtUserEditForm,"USER_DETAILS");
   }
  /* *****************************  */	
  function showCustomQuestionBox(element){
  	if(element.value=="-2"){
  		showDiv("questionZone");
  	}
  	else {
  		hideDiv("questionZone");
  	}
  }
  /* *****************************  */	
  function setQuestionValue(value,index){
  	box1=document.getElementById("SECRET_QUESTION");
  	box2=document.getElementById("SECRET_QUESTION_LDAP");
  	if(box1!=undefined){
  		box1.value=index;
  	}
  	if(box2!=undefined){
  		box2.value=value;
  	}
  	if(box1==undefined){
  		alert("Box1 is undefined");
  	}
  	if(box2==undefined){
  		alert("Box2 is undefined");
  	}
  }      
  function doCancel(theForm) {
    //var ok = confirm('<bean-el:message key="confirmCancel"  bundle="mt.messages"/>');
    if (theForm != null) {

      if (theForm.userId.value != "-1") {
        // existing user
        theForm.action='<html-el:rewrite page="/mt/userView.do" />';
      }
      else {
        theForm.country.length = 0;
        theForm.action='<html-el:rewrite page="/mt/userSearch.do" />';
      }
      theForm.submit();
      return true;
    }
    return false;
  }
  function showDiv(divId) {
	  if(document.getElementById(divId)!=undefined&&document.getElementById(divId)!=null){
	  	   document.getElementById(divId).style.visibility = 'visible';
	  	   document.getElementById(divId).style.display = 'block';
	  }
  }//end func
  function hideDiv(divId) {
	  if(document.getElementById(divId)!=undefined&&document.getElementById(divId)!=null){
	    document.getElementById(divId).style.visibility = 'hidden';
	    document.getElementById(divId).style.display = 'none';
	  }  
  }//end func
 
  
  function showHideAccountDivs(){
  	
  	    var account_type=getCheckedValue(document.mtUserEditForm,"ACCOUNT_TYPE");
 	  	if(account_type==2){
	  		hideDiv('individual_account_data');
	  		showDiv('corporate_account_data');
	  	}
	  	else if(account_type==1){
	  		hideDiv('corporate_account_data');
	  		showDiv('individual_account_data');
	  	}
	  	else {
	  		hideDiv('corporate_account_data');
	  		hideDiv('individual_account_data');
	  	}
  }	
  
  function getCheckedValue(formObject,radioButtonName) {
  	  for(var i=0; i<formObject.elements.length; i++)
      {
      	var temp = formObject.elements[i].type;
      	if((temp == "radio") && (formObject.elements[i].name==radioButtonName) && (formObject.elements[i].checked)) { 
      		return formObject.elements[i].value; 
      	}
      }
      return "-1";
  }
  function getElementValue(formObject,elementName) {
  	  for(var i=0; i<formObject.elements.length; i++)
      {
      	if(formObject.elements[i].name==elementName) { 
      		return formObject.elements[i].value; 
      	}
      }
      return "-1";
  }
  function showHideAccountDiv(element){
  	if(element!=undefined) {
 	  	if(element.value==2){
	  		hideDiv('individual_account_data');
	  		showDiv('corporate_account_data');
	  	}
	  	else
	  	{
	  		hideDiv('corporate_account_data');
	  		showDiv('individual_account_data');
	  	}
  	}
  }	
  function validatePassword(theForm){
   	
   
    var pwd  = "abcdef";
    var pwd2 = "uvwxyz";

    var passwd = trim(theForm.thePassword.value);
    var confirmPasswd = trim(theForm.confirmPassword.value);

    if (theForm.userId.value != "-1") {
      // existing user
      if (((passwd != pwd) || (confirmPasswd != pwd2)) && (passwd != confirmPasswd)) {
        alert("<bean-el:message key='mt.user.alert.passwordNoMatch' bundle='mt.messages'/>");
        return false;
      }
    }
    else {
      if (passwd != confirmPasswd) {
        alert("<bean-el:message key='mt.user.alert.passwordNoMatch' bundle='mt.messages'/>");
        return false;
      }
    }
    return true;
  }

  //
  // Get the group popup
  //
  function doGroupPopup(theForm) {
    var DELIM = '%24%23@!';
    var selectedGroupFQNs = "";
    for (var index = 0; index < document.mtUserEditForm.groupFQNs.length; index++) {
      selectedGroupFQNs += document.mtUserEditForm.groupFQNs.options[index].value + DELIM;
    }

    var DELIM = '%24%23@!';
    var popupUrl = '<c:url value="/mt/groupMultiPopup.do"/>';

    popupUrl += '?callback=setNewGroups';
    popupUrl += '&parentFormName=' + 'abc';
    popupUrl += '&minSelection=0&multiSelect=true';
    popupUrl += '&existingGroupFQNs=' + selectedGroupFQNs;
    popupUrl += '&orgAdminCheck=true';
    
    var windowFeatures = 'width=600,height=600,scrollbars=yes,resizable=yes';
    var popupWindow = window.open(popupUrl, 'GroupPopup', windowFeatures);
    if (popupWindow != null) {
      if (popupWindow.opener == null) {
        popupWindow.opener = self;
      }
    }
    popupWindow.focus();
  }

  //
  // Call back function
  //
  function setNewGroups(ids, names) {
    document.mtUserEditForm.groupFQNs.length = 0;
    for (var index = 0; index < ids.length; index++) {
      var option = new Option(" ");
      option.text = names[index];
      option.value = ids[index];
      document.mtUserEditForm.groupFQNs.options[index] = option;
    }
  }

  function validateGroup(theForm){
<c:if test="${mtUserEditView.map.showUserGroup && (mtUserEditForm.map.userId == -1)}">
  <c:if test="${!mtUserEditView.map.isUserAdmin}">
  	var gLen = theForm.groupFQNs.length
    if (0 == gLen) {
      alert("<bean-el:message key='mt.user.alert.groupNotSpecified' bundle='mt.messages'/>");
      return false;
    }
  </c:if>
    var size = theForm.groupFQNs.length;
    for (var index = 0; index < size ; index++) {
      theForm.groupFQNs.options[index].selected = true;
    }
</c:if>
    return true;
  }


</script>

<html-el:form  action="/mt/userSave.do" onsubmit="return validateMtUserEditForm(this) && validateGroup(this) && validatePassword(this);">
<c:set var="uDataList" scope="page" value="${mtUserEditView.map.userDataList}"/>
<c:set var="uTypeList" scope="page" value="${mtUserEditView.map.userTypeList}"/>
<c:set var="cStatusList" scope="page" value="${mtUserEditView.map.corporateStatusList}"/>
<html-el:hidden name ="mtUserEditForm" property="userId" />
<html-el:hidden name ="mtUserEditForm" property="cancelAction" value="/mt/userSearch.do" />

<!-- Hiddden LDAP Flags --> 
<!-- 
<html-el:hidden name ="mtUserEditForm" property="SECRET_QUESTION_LDAP" />
<html-el:hidden name ="mtUserEditForm" property="ANSWER_LDAP" />
<html-el:hidden name ="mtUserEditForm" property="MOBILE_NO_LDAP" />
<html-el:hidden name ="mtUserEditForm" property="CONTRACT_NUMBER_LDAP" />
<html-el:hidden name ="mtUserEditForm" property="USER_DETAILS_LDAP" />
<html-el:hidden name ="mtUserEditForm" property="ACCOUNT_ID_LDAP" />
-->
<input id="SECRET_QUESTION"  type="hidden" name="SECRET_QUESTION" value="" />
<input id="SECRET_QUESTION_LDAP" type="hidden" name="SECRET_QUESTION_LDAP" value="" />
<input id="ANSWER_LDAP" type="hidden" name ="ANSWER_LDAP" />
<input id="MOBILE_NO_LDAP" type="hidden" name ="MOBILE_NO_LDAP" />
<input id="CONTRACT_NUMBER_LDAP" type="hidden" name ="CONTRACT_NUMBER_LDAP" />
<input id="USER_DETAILS_LDAP" type="hidden" name ="USER_DETAILS_LDAP" />


<!-- End Hiddden LDAP Flags --> 

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">

        <div class="pageTitle">
          <c:if test="${mtUserEditForm.map.userId == -1}">
            <bean-el:message key="mt.user.create.page.title" bundle="mt.messages"/>
          </c:if>
          <c:if test="${mtUserEditForm.map.userId != -1}">
            <bean-el:message key="mt.user.edit.page.title" bundle="mt.messages"/>:
            <c:out value="${mtUserEditView.map.formattedName}"/>
          </c:if>
        </div> 

	<div class="errorMessage">
          <html-el:errors bundle="mt.messages"/>
        </div>
        <%@include file="/mc/common/pagetab.jsp" %>

      <!-- end of PageTab -->			

      <div class="pageSubtitle">
        <span class="left">
            <bean-el:message key="mt.user.userInfo" bundle="mt.messages"/>
        </span>
      </div>        
      
      <!--start main content area here-->
      <table width="100%" border="0" cellspacing="0" cellpadding="2">
        <tr>
          <!--Start page instructions(if any)-->
          <td height="1" class="pageInstructions">
            <br>
            <c:if test="${mtUserEditForm.map.userId == -1}">
              <bean-el:message key="mt.user.create.instruction" bundle="mt.messages"/>
            </c:if>
            <c:if test="${mtUserEditForm.map.userId != -1}">
              <bean-el:message key="mt.user.edit.instruction" bundle="mt.messages"/>
            </c:if>
          </td>
          <!--End page instructions(if any)-->
        </tr>
      </table>

      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">
        <tr>
          <td valign="middle" width="16%" class="label">
              <bean-el:message key="mt.user.label.loginId" bundle="mt.messages"/>*:
          </td>
          <td valign="middle" width="24%" class="labelField">
            <c:if test="${mtUserEditForm.map.userId == -1}">
              <html-el:text maxlength="255" property="userAlias"/> &nbsp;
            </c:if>
            <c:if test="${mtUserEditForm.map.userId != -1}">
              <c:out value="${mtUserEditForm.map.userAlias}"/>&nbsp;
              <html-el:hidden property="userAlias"/>
            </c:if>

          </td>
          <td class="label" width="15%">
            <c:if test="${mtUserEditView.map.showUserTemplate}">
              <bean-el:message key="mt.user.label.userTemplate" bundle="mt.messages"/>:
            </c:if>
          </td>
          <td class="labelField" width="35%">
            <c:if test="${mtUserEditView.map.showUserTemplate}">
              <c:set var="uTList" scope="page" value="${mtUserEditView.map.userTemplateList}"/>
              <c:if test="${mtUserEditView.map.editable}">
                <html-el:select name="mtUserEditForm" property="epUserTmplId"> 
                  <html-el:options collection="uTList" property="id" labelProperty="name" />
                </html-el:select>
              </c:if>
              <c:if test="${!mtUserEditView.map.editable}">
                <c:forEach var="uT" items="${uTList}">
                  <c:if test="${uT.id == mtUserEditForm.map.epUserTmplId}">
                    <c:out value="${uT.name}"/>
                  </c:if>
                </c:forEach>
                <input type="hidden" name="epUserTmplId" value="<c:out value="${mtUserEditForm.map.epUserTmplId}"/>"/>
              </c:if>
            </c:if>
          </td>
        </tr>
        <tr> 
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.password" bundle="mt.messages"/>*:
            </td>
            <td class="labelField" width="30%">
              <html-el:password maxlength="80" property="thePassword"/>
            </td>
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.verifyPassword" bundle="mt.messages"/>*:
            </td>
            <td class="labelField" width="30%">
              <html-el:password  maxlength="80" property="confirmPassword"/>
            </td>
          </tr>
		
		  <tr>
           <td valign="middle" width="16%" class="label"> 
             <c:if test="${mtUserEditView.map.showUserTemplate}">
               <bean-el:message key="mt.user.label.active" bundle="mt.messages"/>:
             </c:if>
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:if test="${mtUserEditView.map.showUserTemplate}">
               <!-- html-el:checkbox property="kmUserDeleted"/ -->
               <c:if test="${mtUserEditView.map.editable}">
                 <html-el:radio property="kmUserDeleted" value="true"/><bean-el:message key="mt.user.label.yes" bundle="mt.messages"/>
                  &nbsp;
                 <html-el:radio property="kmUserDeleted" value="false"/><bean-el:message key="mt.user.label.no" bundle="mt.messages"/>
               </c:if>
               <c:if test="${!mtUserEditView.map.editable}">
                 <c:if test="${mtUserEditForm.map.kmUserDeleted}">
                   <bean-el:message key="mt.user.label.yes" bundle="mt.messages"/>
                   <input type="hidden" name="kmUserDeleted" value="true"/>
                 </c:if>
                 <c:if test="${!mtUserEditForm.map.kmUserDeleted}">
                   <bean-el:message key="mt.user.label.no" bundle="mt.messages"/>
                   <input type="hidden" name="kmUserDeleted" value="false"/>
                 </c:if>
               </c:if>
             </c:if>
           </td>
           <td valign="middle" width="16%" class="label">
             <c:if test="${mtUserEditView.map.showUserTemplate}">
               <bean-el:message key="mt.user.label.receivedEmailAlerts" bundle="mt.messages"/>:
             </c:if>
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:if test="${mtUserEditView.map.showUserTemplate}">
              <html-el:checkbox property="epEmailAlert"/>
             </c:if>
           </td>
         </tr>

         <c:if test="${mtUserEditView.map.showUserGroup}">
           <c:if test="${mtUserEditForm.map.userId == -1}">
             <tr>
               <td valign="middle" width="16%" class="label"> 
                 <bean-el:message key="mt.user.label.groups" bundle="mt.messages"/>:
               </td>
               <td valign="top" width="34%" class="labelField">
                 <html-el:select multiple="true" size="3" property="groupFQNs">
                 </html-el:select>
                  <input class="pageButton" type="button" onclick="JavaScript:doGroupPopup(this.form)" value='<bean-el:message key="button.selectGroups" bundle="mt.messages"/>'/>
               </td>
               <td valign="middle" width="16%" class="label"> 
               </td>
               <td valign="top" width="34%" class="labelField">
               </td>
             </tr>
           </c:if>
         </c:if>
          <tr> 
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.email" bundle="mt.messages"/>*:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="email"/>
            </td>
           <td class="label" width="20%">
               Preferred Language:
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="PREFERRED_LANGUAGE"> 
                  <option value="-1">Select Preferred Language</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Language'}">
                       <c:choose>
      				<c:when test="${uT.value == mtUserEditForm.map.PREFERRED_LANGUAGE}">
      					<option selected="selected" value="<c:out value="${uT.value}"/>"> <c:out value="${uT.key}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.value}"/>"><c:out value="${uT.key}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              	</html-el:select>
            </td>
          </tr>
            <tr> 
            <td class="label" width="20%">
              Secret Question:
            </td>
            <td class="labelField" width="30%">
                <select id="SECRET_QUESTION_1" name="SECRET_QUESTION_1" onchange="showCustomQuestionBox(this)"> 
                  <option value="-1">Select Secret Question</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Secret Question'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.SECRET_QUESTION}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
      			    <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
                   
                   <c:choose>
      		       <c:when test="${mtUserEditForm.map.SECRET_QUESTION == -2}">
      					<option selected="selected" value="-2">Other</option>
      			   </c:when>
      			    <c:otherwise>
			      		<option value="-2">Other</option>
			        </c:otherwise>
    			  </c:choose>
               </select>
               <br /><br />
               <c:choose>
      		       <c:when test="${mtUserEditForm.map.SECRET_QUESTION == -2}">
      					<div id="questionZone"  ><input id="SECRET_QUESTION_2" size="40" type="text" name="SECRET_QUESTION_2" onclick="if(this.value=='Type custom Question..'){this.value='';}" value="<c:out value="${mtUserEditForm.map.SECRET_QUESTION_LDAP}"/>" /></div>
      			   </c:when>
      			    <c:otherwise>
			      		<div id="questionZone" style="visibility:hidden;display:none"><input id="SECRET_QUESTION_2" size="40" type="text" name="SECRET_QUESTION_2" onclick="if(this.value=='Type custom Question..'){this.value='';}" value="Type custom Question.." /></div>
			        </c:otherwise>
    			  </c:choose>
           </td>
            <td class="label" width="20%">
              Answer:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="ANSWER"/>
            </td>
          </tr>
		 <tr> 
            <td class="label" width="20%">
               Account Type:
            </td>
            <td class="labelField" width="30%">
              <html-el:radio property="ACCOUNT_TYPE" value="1" onclick="showHideAccountDiv(this)"  />Individual
                  &nbsp;
              <html-el:radio property="ACCOUNT_TYPE" value="2" onclick="showHideAccountDiv(this)"   />Corporate
          </td>
            <td class="label" width="20%">
               User Type:
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="USER_DETAILS"> 
                  <option value="-1">Select User Type</option>
                  <c:forEach var="uT" items="${uTypeList}">
                   <c:choose>
      				<c:when test="${uT.value == mtUserEditForm.map.USER_DETAILS}">
      					<option selected="selected" value="<c:out value="${uT.value}"/>"> <c:out value="${uT.key}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.value}"/>"><c:out value="${uT.key}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:forEach>
              	</html-el:select>
            </td>
          </tr>
		</table>
		
		<div id="individual_account_data">	
        
        <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">

          <c:if test="${!mtUserEditView.map.useFullName}">
              <tr> 
                <td class="label" width="20%">
                  <bean-el:message key="mt.user.label.firstName" bundle="mt.messages"/>*:
                </td>
                <td class="labelField" width="30%">
                  <html-el:text maxlength="100" property="firstName"/>
                </td>
                <td class="label" width="20%">
                  <bean-el:message key="mt.user.label.middleName" bundle="mt.messages"/>:
                </td>
                <td class="labelField" width="30%">
                  <html-el:text maxlength="55" property="middleName"/>
                </td>
              </tr>
          </c:if>
          <tr> 
            <c:choose>
                <c:when test="${mtUserEditView.map.useFullName}">

                  <html-el:hidden property="firstName" value="xxx"/>
                  <html-el:hidden property="middleName" value="xxx"/>
                  <html-el:hidden property="lastName" value="xxx"/>
                  <td class="label" width="20%">
                    <bean-el:message key="mt.user.label.fullName" bundle="mt.messages"/>*:
                  </td>
                  <td class="labelField" width="30%">
                    <html-el:text size="30" maxlength="50" property="fullName"/>
                  </td>
                </c:when>
                <c:otherwise>
                  <html-el:hidden property="fullName" value="xxx"/>

                  <td class="label" width="20%">
                    <bean-el:message key="mt.user.label.lastName" bundle="mt.messages"/>*:
                  </td>
                  <td class="labelField" width="30%">
                    <html-el:text maxlength="100" property="lastName"/>
                  </td>
                </c:otherwise>
              </c:choose>
            <td class="label" width="20%">
                <bean-el:message key="mt.user.label.mailStop" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
                <html-el:text maxlength="50" property="mailStop"/>
            </td>
          </tr>
          
     
		   <tr> 
            <td class="label" width="20%">
             Name (Other):
            </td>
            <td class="labelField" colspan="3" >
              <html-el:text maxlength="20" property="NAME"/>
            </td>
           </tr> 	
		  <tr> 
            <td class="label" width="20%">
              Arabic Name:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="ARABIC_NAME"/>
            </td>
            <td class="label" width="20%">
               Nationality:
            </td>
            <td class="labelField" width="30%">
               <html-el:hidden property="country"/>
               <html-el:select name="mtUserEditForm" property="NATIONALITY"> 
                  <option value="-1">Select Nationality</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Country'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.NATIONALITY}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              	</html-el:select>
            </td>
          </tr>
            <tr> 
            <td class="label" width="20%">
              Mobile Number:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="MOBILE_NO"/>
            </td>
            <td class="label" width="20%">
              Activation Code:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="ACTIVATION_CODE"/>
            </td>
          </tr>
		  
		  <tr> 
            <td class="label" width="20%">
               Civil Id:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="CIVIL_ID"/>
            </td>
                      <td class="label" width="20%">
              <bean-el:message key="mt.user.label.zipCode" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="20" property="zipCode"/>
            </td>
          </tr>
          <tr> 
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.addressLine1" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="address1"/>
            </td>
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.addressLine2" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="address2"/>
            </td>
          </tr>
          <tr> 
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.city" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
             <html-el:hidden  property="city"/> 
                    <html-el:select name="mtUserEditForm" property="CITY_2"> 
                  <option value="-1">Select City</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'City'}">
                   <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.CITY_2}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            </td>
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.state" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="20" property="state"/>
            </td>
          </tr>
          
          <tr> 
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.phone" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="phone"/>
            </td>
            <td class="label" width="20%">
              <bean-el:message key="mt.user.label.fax" bundle="mt.messages"/>:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="fax"/>
            </td>
          </tr>
         
		 
		  <tr> 
            <td class="label" width="20%">
              Date of Birth (Date):
            </td>
            <td class="labelField" width="30%">
          <%--<html-el:text maxlength="255" property="DOB"/> --%>
          
          	<bvhtml:date property="DOB"
							onChangeMonth="onChangeMonth"
							onChangeYear="onChangeYear"
							noblank="true"/>
							<a href="JavaScript:datePopup(
							'<html:rewrite page="/mc/calendar.do"/>',
							'mtUserEditForm','DOB')"><img
							src="<%= ctxPath %>/mc/images/action/calendar.gif"
							width="22" height="22"
							alt='Choose Date'
							title='Choose Date'
							border="0" align="absmiddle"/></a>
													
						
			   </td>				
              <td class="label" width="20%">
              PO Box:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="POBOX"/>
            </td>
          </tr>
		  
		   <tr> 
            <td class="label" width="20%">
              Residential Area:
            </td>
            <td class="labelField" width="30%">
                <html-el:select name="mtUserEditForm" property="RESIDENTIAL_AREA"> 
                  <option value="-1">Select Residence Area</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Residential Area'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.RESIDENTIAL_AREA}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              	</html-el:select>
            </td>
            <td class="label" width="20%">
              Residence Length:
            </td>
            <td class="labelField" width="30%">
                <html-el:select name="mtUserEditForm" property="RESIDENCE_LENGTH"> 
                  <option value="-1">Select Residence Length</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Residential Length'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.RESIDENCE_LENGTH}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              	</html-el:select>
            </td>
          </tr>
		  
		   <tr> 
            <td class="label" width="20%">
              Hobbies:
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="HOBBIES"> 
                  <option value="-1">Select Hobbies</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Hobbies'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.HOBBIES}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              </html-el:select>
            </td>
            <td class="label" width="20%">
              Magazines:
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="MAGAZINES"> 
                  <option value="-1">Select Magazines</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Magazines'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.MAGAZINES}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
              </html-el:select>
              
            </td>
          </tr>
		  
		  <tr> 
            <td class="label" width="20%">
                   Tv Programs:
            </td>
            <td class="labelField" colspan="3">
              <html-el:select name="mtUserEditForm" property="TV_PROGRAMS"> 
                  <option value="-1">Select TV Programs</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'TV Programs'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.TV_PROGRAMS}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            </td>
          </tr>
		  </table>
		  
		  </div> <!--End Individual Data -->
		  <div id="corporate_account_data">
		  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">
		     <tr> 
           <td class="label" width="20%">
               Corporate User Status:
            </td>
            <td class="labelField" colspan="3">
                <html-el:select name="mtUserEditForm" property="CORPORATE_USER_STATUS"> 
                  <option value="-1">Select Corporate User Status</option>
                  <c:forEach var="uT" items="${cStatusList}">
                   <c:choose>
      				<c:when test="${uT.value == mtUserEditForm.map.CORPORATE_USER_STATUS}">
      					<option selected="selected" value="<c:out value="${uT.value}"/>"> <c:out value="${uT.key}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.value}"/>"><c:out value="${uT.key}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:forEach>
              	</html-el:select>
            </td>
          </tr>
            <tr> 
            <td class="label" width="20%">
              Application Date (Date):
            </td>
            <td class="labelField" width="30%">
          <%--<html-el:text maxlength="255" property="APPLICATION_DATE"/> --%>
          <bvhtml:date property="APPLICATION_DATE"
							onChangeMonth="onChangeMonth"
							onChangeYear="onChangeYear"
							noblank="true"/>
							<a href="JavaScript:datePopup(
							'<html:rewrite page="/mc/calendar.do"/>',
							'mtUserEditForm','APPLICATION_DATE')"><img
							src="<%= ctxPath %>/mc/images/action/calendar.gif"
							width="22" height="22"
							alt='Choose Date'
							title='Choose Date'
							border="0" align="absmiddle"/></a>
            </td>
            <td class="label" width="20%">
              Approval Date (Date):
            </td>
            <td class="labelField" width="30%">
            <!--   <html-el:text maxlength="255" property="APPROVAL_DATE"/>  -->
             <bvhtml:date property="APPROVAL_DATE"
							onChangeMonth="onChangeMonth"
							onChangeYear="onChangeYear"
							noblank="true"/>
							<a href="JavaScript:datePopup(
							'<html:rewrite page="/mc/calendar.do"/>',
							'mtUserEditForm','APPROVAL_DATE')"><img
							src="<%= ctxPath %>/mc/images/action/calendar.gif"
							width="22" height="22"
							alt='Choose Date'
							title='Choose Date'
							border="0" align="absmiddle"/></a>
            </td>
          </tr>
		 <tr> 
            <td class="label" width="20%">
              Organization Name:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="ORGANIZATION_NAME"/>
            </td>
            <td class="label" width="20%">
              Organization Type:
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="ORGANIZATION_TYPE"> 
                  <option value="-1">Select Organization Type</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Organization Type'}">
                   <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.ORGANIZATION_TYPE}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            </td>
          </tr>
		  
		 <tr> 
            <td class="label" width="20%">
              Business Objectives: 
            </td>
            <td class="labelField" width="30%">
              <html-el:select name="mtUserEditForm" property="BUSINESS_OBJECTIVES"> 
                  <option value="-1">Select Business Objective</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Business Objective'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.BUSINESS_OBJECTIVES}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            
            </td>
            <td class="label" width="20%">
              Registration Id: 
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="REGISTRATION_ID"/>
            </td>
          </tr>
		 		
		 <tr> 
            <td class="label" width="20%">
              Years of Estabilshment: 
            </td>
            <td class="labelField" width="30%">
               <html-el:select name="mtUserEditForm" property="YEARS_OF_ESTABLISHMENT"> 
                  <option value="-1">Select Years of Establishment</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Years of Establishment'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.YEARS_OF_ESTABLISHMENT}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            </td>
            <td class="label" width="20%">
              Employees Range:
            </td>
            <td class="labelField" width="30%">
                 <html-el:select name="mtUserEditForm" property="EMPLOYEES_RANGE"> 
                  <option value="-1">Select Employees Range</option>
                  <c:forEach var="uT" items="${uDataList}">
                   <c:if test="${uT.name == 'Number of Employees'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserEditForm.map.YEARS_OF_ESTABLISHMENT}">
      					<option selected="selected" value="<c:out value="${uT.id}"/>"> <c:out value="${uT.value}"/>  </option>
      				</c:when>
			        <c:otherwise>
			      		<option value="<c:out value="${uT.id}"/>"><c:out value="${uT.value}"/> </option>
			        </c:otherwise>
    			   </c:choose>
                   </c:if>
                   </c:forEach>
               </html-el:select>
            </td>
          </tr>
		  
		   <tr> 
            <td class="label" width="20%">
              GSM: 
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="GSM"/>
            </td>
            <td class="label" width="20%">
              ETACS:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="ETACS"/>
            </td>
          </tr>		
		  
		   <tr> 
            <td class="label" width="20%">
               PAGER: 
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="PAGER"/>
            </td>
            <td class="label" width="20%">
               Contact Person:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="CONTACT_PERSON"/>
            </td>
          </tr>		
		  
		   <tr> 
            <td class="label" width="20%">
                Contact Number:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="CONTACT_NUMBER"/>
            </td>
            <td class="label" width="20%">
                Contact Title:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="50" property="CONTACT_TITLE"/>
            </td>
          </tr>		
		  
		   <tr> 
            <td class="label" width="20%">
                Comments:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="COMMENTS"/>
            </td>
            
            <td class="label" width="20%">
                Contract Number:
            </td>
            <td class="labelField" width="30%">
              <html-el:text maxlength="255" property="CONTRACT_NUMBER"/>
            </td>
            
          </tr>		
		
	
	
					
        </table>
        
        </div> <!-- End Corporate Account Data -->     
           
       <!--end main content area here-->

      <div class="pageButtonWrap" align="right">
          <html-el:reset styleClass="inputButton" property="resetBtn">
            <bean-el:message key="button.reset" bundle="mt.messages" />
	  </html-el:reset>
          &nbsp;
          &nbsp;
          <html-el:button styleClass="inputButton" property="cancelBtn" onclick="return doCancel(this.form)">
            <bean-el:message key="button.cancel" bundle="mt.messages"/>
          </html-el:button>
          <html-el:submit styleClass="inputButton" onclick="checkForm()" property="submitBtn">
            <bean-el:message key="button.save" bundle="mt.messages"/>
          </html-el:submit>
      </div>

    </td>
  </tr>
</table>
<script>
showHideAccountDivs();
</script>
</html-el:form>

